/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package b_and_b_properties;

import b_and_b_properties.data.DAO;
import b_and_b_properties.data.Property;
import java.awt.BorderLayout;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;

/**
 *
 * @author LeQuan
 */
public class WorkOrder extends JFrame {

    private DAO dao;
    String[] urgencySelect = {"Urgent", "Not Urgent"};
    private JTextField ID;
    private JLabel pid;
    private JTextField Unit;
    private JLabel un;
    private JTextArea Work;
    private JLabel notes;
    private JComboBox urg;
    private JLabel Urgency;
    private JLabel WorkOrderNumber;
    private JTextField woa;
    private JButton Submit;
    private JLabel address;
    private JTextField adds;

    public WorkOrder(DAO dao) {
        /**creates the Frame*/
        super("Work Order");
        this.dao = dao;
        this.setLayout(new GridLayout(4, 1, 5, 5));
        this.setPreferredSize(new Dimension(500, 300));
        this.setVisible(true);
        this.setResizable(false);
        createSearch();
        this.pack();
    }
    public void createSearch() {
        /**Adds panel 1 to the frame*/
        JPanel p1 = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
        pid = new JLabel("Property ID:");
        p1.add(pid);
        ID = new JTextField(10);
        p1.add(ID);
        WorkOrderNumber = new JLabel("Work Order Number");
        p1.add(WorkOrderNumber);
        woa = new JTextField(10);
        woa.setEditable(false);
        p1.add(woa);
        Urgency = new JLabel("Urgency:");
        p1.add(Urgency);
        urg = new JComboBox(urgencySelect);
        urg.setSelectedIndex(1);
        p1.add(urg);
        add(p1);

        /**Adds panel 6 to the frame*/
        JPanel p6 = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 0));
        address = new JLabel("Address:");
        p6.add(address);
        adds = new JTextField(20);
        adds.setEditable(false);
        p6.add(adds);
        un = new JLabel("Unit Number:");
        p6.add(un);
        Unit = new JTextField(10);
        p6.add(Unit);
        add(p6);


        /** Adds panel 4 to the Frame*/
        JPanel p4 = new JPanel(new BorderLayout(1, 1));
        notes = new JLabel("Notes:");
        p4.add(notes, BorderLayout.WEST);
        Work = new JTextArea("", 5, 50);
        Work.setLineWrap(true);
        JScrollPane scrollBar = new JScrollPane(Work);
        scrollBar.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        p4.add(scrollBar, BorderLayout.CENTER);
        add(p4);

        /** Adds panel 5 to the Frame*/
        JPanel p5 = new JPanel();
        Submit = new JButton("Submit");
        p5.setSize(100, 20);
        p5.add(Submit);
        add(p5);

        Submit.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){

            }
        });

    }
}
